/*******************************************************************************
 * Copyright (c) 2008, 2009 Tapestry IDE Developers
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     Tapestry IDE Developers - initial API and implementation
 *******************************************************************************/
package com.googlecode.tapestry.ide.core.model;

import org.eclipse.core.resources.IResource;
import org.eclipse.jdt.core.ICompilationUnit;

/**
 * The Class AbstractTapestryItem.
 */
public abstract class AbstractTapestryItem extends AbstractModelElement
		implements ITapestryItem {

	/** The compilation unit. */
	private ICompilationUnit compilationUnit;

	/** The template resource. */
	private IResource templateResource;

	/**
	 * Instantiates a new abstract tapestry item.
	 * 
	 * @param compilationUnit
	 *            the compilation unit
	 * @param templateResource
	 *            the template resource
	 * @param parent
	 *            the parent
	 * @param name
	 *            the name
	 */
	protected AbstractTapestryItem(String name,
			ICompilationUnit compilationUnit, IResource templateResource,
			IModelElement parent) {
		super(parent, name);
		this.compilationUnit = compilationUnit;
		this.templateResource = templateResource;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.googlecode.tapestry.ide.core.model.ITapestryItem#getCompilationUnit()
	 */
	public ICompilationUnit getCompilationUnit() {
		return compilationUnit;
	}

	/**
	 * Sets the template resource.
	 * 
	 * @param templateResource
	 *            the new template resource
	 */
	public void setTemplateResource(IResource templateResource) {
		this.templateResource = templateResource;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.googlecode.tapestry.ide.core.model.ITapestryItem#getTemplateResource
	 * ()
	 */
	public IResource getTemplateResource() {
		return templateResource;
	}

}
